<?php

function connect() {
    return new PDO('mysql:host=localhost;dbname=naobrazki', 'root', '');
    ;
}

function transaction($dbh) {

    $stmt1 = $dbh->prepare("INSERT INTO images (content_type, lob) values(:content,:lob)");
    //$stmt2 = $dbh -> prepare ("INSERT INTO config ( name, value) values(:name,:value)");
    //$stmt2 -> bindParam (':name',$_FILES['my_little_file']['name']);
    //$stmt2 -> bindParam (':value',$_FILES['my_little_file']['size']);

    var_dump($_FILES['my_little_file']['tmp_name']);
    echo'<br>';
    var_dump($_FILES['my_little_file']['type']);
    echo'<br>';
    $stmt1->bindParam(':content', $_FILES['my_little_file']['type']);
    $file = fopen($_FILES['my_little_file']['tmp_name'], 'rb');
    var_dump($file);
    $stmt1->bindParam(':lob', $file, PDO::PARAM_LOB);

    $dbh->beginTransaction();
    $stmt1->execute();
    //$stmt2->execute();
    $dbh->commit();
}
?>
